﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Xpom_Xpum__Integrated_Development_Environment.View
{
    /// <summary>
    /// Interaction logic for IntegratorSettingsWindowView.xaml
    /// </summary>
    public partial class IntegratorSettingsWindowView : Window
    {
        public IntegratorSettingsWindowView()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = ((App)App.Current).iswvm;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            var abwv = new AddBrowserWindowView();
            abwv.Owner = this;
            abwv.ShowDialog();
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            ((App)App.Current).iswvm.RemoveSelectedBrowser();
        }

        private void button5_Click(object sender, RoutedEventArgs e)
        {

        }

        private void button6_Click(object sender, RoutedEventArgs e)
        {
            var result = MessageBox.Show("Do you sure?",
                "Question",
                MessageBoxButton.YesNo, MessageBoxImage.Question);
            if (result == MessageBoxResult.Yes)
            {
                ((App)App.Current).iswvm.ResetDefault();
            }
        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
            ((App)App.Current).iswvm.Save();
            this.Close();
        }

        private void button4_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void listView1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            bool isNotNull = (listView1.SelectedItem != null);
            button2.IsEnabled = isNotNull;
            button5.IsEnabled = isNotNull;
        }
    }
}
